---
title: "Confucian Gender Norms and Women's Political Participation"
author: "Meichao Song"
date: "2025-09-02"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(pacman)
p_load(rio) #import data
p_load(tidyverse)
p_load(dplyr)
p_load(ggplot2)
p_load(haven)
p_load(ggplot2)
p_load(purrr)
p_load(broom)
p_load(stargazer)
p_load(purrr)
p_load(psych) #检测克隆巴赫阿尔法系数   
p_load(countrycode)
p_load(texreg)
p_load(stargazer)
p_load(car)
p_load(patchwork)
p_load(officer)
p_load(gridExtra)
p_load(reshape2)
p_load(mediation)
p_load(interactions)
```

# 1. Import and Clean Data

## (1) Import Asian Survey Data (Wave 5)
```{r}
ABS <- import("ABS_wave5 0628recode.sav") 
# table(ABS$COUNTRY)
```

## (2) Compute Independent Variable and Dependent Variable

All the items used have been recoded using SPSS. The following shows only the summing process. The recoding rule is very simple: change the direction of the values so that the larger the value, the higher the agreement with the statement. Missing values have been removed.

```{r}
# Independent Variable
ABS <- ABS |>
  mutate(TGN4 = q146_recode + q69recode + q62_recode + q63_recode)
```

```{r}
# Dependent Variable

# PP_Contact
ABS<-ABS |> 
  mutate(PP_Contact=q70recode+q71recode+q72recode+q73recode)

# PP_Protest
ABS<-ABS |> 
  mutate(PP_Protest=q74recode+q75recode+q77recode+q78recode+q79recode+q80recode)

# PP_Vote
summary(ABS$PP_Vote)
```

## (3) Create Confucian Dummy Variable
```{r}
confucian_countries <- c(1, 2, 3, 4, 7, 10, 11)
ABS <- ABS %>%
  mutate(Confucian = if_else(COUNTRY %in% confucian_countries, 1, 0))
```


## (4) Filter 7 Confucian Societies
```{r}
japan <- ABS %>% 
  filter(COUNTRY == 1)  

Hong_Kong<- ABS %>% 
  filter(COUNTRY == 2) 

south_korea <- ABS %>% 
  filter(COUNTRY == 3) 

china <- ABS %>% 
  filter(COUNTRY == 4) 

taiwan <- ABS %>% 
  filter(COUNTRY == 7) 

singapore <- ABS %>% 
  filter(COUNTRY == 10) 

vietnam <- ABS %>% 
  filter(COUNTRY == 11) 

Confucian_Society<-rbind(japan,Hong_Kong,south_korea,china,taiwan,singapore, vietnam)
```


# 2. Regression Table Replication

## (1) Table 3
```{r}
model_1 <- lm(PP_Contact ~ TGN4+gender+TGN4*gender+age+education+married+rural+factor(COUNTRY), data = Confucian_Society)

model_2 <- lm(PP_Protest ~ TGN4+gender+TGN4*gender+age+education+married+rural+factor(COUNTRY), data = Confucian_Society)

model_3 <- glm(PP_Vote ~ TGN4 + gender +TGN4*gender+age + education + married + rural + factor(COUNTRY), 
                family = binomial(link = "logit"), data = Confucian_Society)

stargazer(model_1,model_2,model_3,
          type = "text",
          title = "Table 1: Gender Norms and Women's Political Participation in EA）",
          add.lines = list(c("Country Fixed Effect", "Yes", "Yes","Yes")),
          omit = "Country", # 省略国家固定效应的系数
          notes = "Country fixed effects are included but not displayed.") # 添加说明
```
## (2) Table 4
```{r}
# Women Should Participate Less

model_1 <- lm(PP_Contact ~ q146_recode+gender+q146_recode*gender+age+education+married+rural+factor(COUNTRY), data = Confucian_Society)

model_2 <- lm(PP_Protest ~ q146_recode+gender+q146_recode*gender+age+education+married+rural+factor(COUNTRY), data = Confucian_Society)

model_3 <- glm(PP_Vote ~ q146_recode + gender +q146_recode*gender+age + education + married + rural + factor(COUNTRY), 
                family = binomial(link = "logit"), data = Confucian_Society)

stargazer(model_1,model_2,model_3,
          type = "text",
          title = "Table 1: Gender Norms and Women's Political Participation in EA）",
          add.lines = list(c("Country Fixed Effect", "Yes", "Yes","Yes")),
          omit = "Country", # 省略国家固定效应的系数
          notes = "Country fixed effects are included but not displayed.") # 添加说明
```

```{r}
# Son Preference

model_1 <- lm(PP_Contact ~ q69recode+gender+q69recode*gender+age+education+married+rural+factor(COUNTRY), data = Confucian_Society)

model_2 <- lm(PP_Protest ~ q69recode+gender+q69recode*gender+age+education+married+rural+factor(COUNTRY), data = Confucian_Society)

model_3 <- glm(PP_Vote ~ q69recode + gender +q69recode*gender+age + education + married + rural + factor(COUNTRY), 
                family = binomial(link = "logit"), data = Confucian_Society)

stargazer(model_1,model_2,model_3,
          type = "text",
          title = "Table 1: Gender Norms and Women's Political Participation in EA）",
          add.lines = list(c("Country Fixed Effect", "Yes", "Yes","Yes")),
          omit = "Country", # 省略国家固定效应的系数
          notes = "Country fixed effects are included but not displayed.") # 添加说明
```
```{r}
# Obedience to Parents

model_1 <- lm(PP_Contact ~ q62_recode+gender+q62_recode*gender+age+education+married+rural+factor(COUNTRY), data = Confucian_Society)

model_2 <- lm(PP_Protest ~ q62_recode+gender+q62_recode*gender+age+education+married+rural+factor(COUNTRY), data = Confucian_Society)

model_3 <- glm(PP_Vote ~ q62_recode + gender +q62_recode*gender+age + education + married + rural + factor(COUNTRY), 
                family = binomial(link = "logit"), data = Confucian_Society)

stargazer(model_1,model_2,model_3,
          type = "text",
          title = "Table 1: Gender Norms and Women's Political Participation in EA）",
          add.lines = list(c("Country Fixed Effect", "Yes", "Yes","Yes")),
          omit = "Country", # 省略国家固定效应的系数
          notes = "Country fixed effects are included but not displayed.") # 添加说明
```
```{r}
# Obedience to Mother-in-Law

model_1 <- lm(PP_Contact ~ q63_recode+gender+q63_recode*gender+age+education+married+rural+factor(COUNTRY), data = Confucian_Society)

model_2 <- lm(PP_Protest ~ q63_recode+gender+q63_recode*gender+age+education+married+rural+factor(COUNTRY), data = Confucian_Society)

model_3 <- glm(PP_Vote ~ q63_recode + gender +q63_recode*gender+age + education + married + rural + factor(COUNTRY), 
                family = binomial(link = "logit"), data = Confucian_Society)

stargazer(model_1,model_2,model_3,
          type = "text",
          title = "Table 1: Gender Norms and Women's Political Participation in EA）",
          add.lines = list(c("Country Fixed Effect", "Yes", "Yes","Yes")),
          omit = "Country", # 省略国家固定效应的系数
          notes = "Country fixed effects are included but not displayed.") # 添加说明
```


## (3) Table 5
```{r}

model_1 <- lm(PP_Contact ~ TGN4 + gender + TGN4*gender + Confucian +
              age + education + married + rural + factor(COUNTRY), data = ABS)

model_2 <- lm(PP_Protest ~ TGN4 + gender + TGN4*gender + Confucian +
              age + education + married + rural + factor(COUNTRY), data = ABS)

model_3 <- glm(PP_Vote ~ TGN4 + gender + TGN4*gender + Confucian +
               age + education + married + rural + factor(COUNTRY),
               family = binomial(link = "logit"), data = ABS)

stargazer(model_1,model_2,model_3,
          type = "text",
          title = "Table 1: Gender Norms and Women's Political Participation in EA）",
          add.lines = list(c("Country Fixed Effect", "Yes", "Yes")),
          omit = "factor\\(COUNTRY\\)",  # 正则表达式
          notes = "Country fixed effects are included but not displayed.") # 添加说明

```


## (4) Appendix Table A. Descriptive Statistics of the Variables

### Dependent Variable
```{r}
describe(Confucian_Society$PP_Contact) #Contact
describe(Confucian_Society$PP_Protest) #Protest
describe(Confucian_Society$PP_Vote) #Vote
```


### Independent Variable
```{r}
describe(Confucian_Society$q146_recode) #Women Should Participate Less
describe(Confucian_Society$q69recode) #Son Preference
describe(Confucian_Society$q62_recode) #Obedience to Parents
describe(Confucian_Society$q63_recode) #Obedience to Mother-in-Law
```

### Control Variable
```{r}
describe(Confucian_Society$age) #Age
describe(Confucian_Society$education) #Education
describe(Confucian_Society$rural) #Rural
describe(Confucian_Society$married) #Married
```

## (5) Appendix Table B: Robust Test
```{r}
library(estimatr)
library(sandwich)
library(stargazer)

model_1 <- lm(PP_Contact ~ TGN4 + gender + TGN4*gender + age + education + married + rural + factor(COUNTRY), data = Confucian_Society)
model_2 <- lm(PP_Protest ~ TGN4 + gender + TGN4*gender + age + education + married + rural + factor(COUNTRY), data = Confucian_Society)

model_3 <- glm(PP_Vote ~ TGN4 + gender + TGN4*gender + age + education + married + rural + factor(COUNTRY), 
               family = binomial(link = "logit"), data = Confucian_Society)

robust_se_1_HC2 <- sqrt(diag(vcovHC(model_1, type = "HC2")))
robust_se_2_HC2 <- sqrt(diag(vcovHC(model_2, type = "HC2")))
robust_se_3_HC2 <- sqrt(diag(vcovHC(model_3, type = "HC2")))

stargazer(model_1, model_2, model_3,
          se = list(robust_se_1_HC2, robust_se_2_HC2, robust_se_3_HC2),  # 使用HC2标准误
          type = "text",
          title = "Table 1: Gender Norms and Women's Political Participation in EA",
          add.lines = list(c("Country Fixed Effect", "Yes", "Yes", "Yes")),
          omit = "factor\\(COUNTRY\\)",
          notes = "Country fixed effects are included but not displayed.")
```



# 3. Figure Replica

## Figure 1: Q69 Protest
```{r}

Confucian_Society$COUNTRY <- as.factor(Confucian_Society$COUNTRY)
table(Confucian_Society$COUNTRY)

model_2 <- lm(PP_Protest ~ q69recode + gender + q69recode*gender +
               age + education + married + rural +factor(COUNTRY), data = Confucian_Society)

interact_plot(
  model_2,
  pred = q69recode,
  modx = gender,
  data = Confucian_Society,
  plot.points = FALSE,         # 不画预测点
  interval = TRUE,             # 保留置信区间
  modx.labels = c("Men", "Women"),
  main.title = "Interaction Effect of Son Preference and Gender on Protest",
  x.label = "Son Preference",
  y.label = "Predicted Probability of Protest",
  legend.main = "Gender",
  colors = c("#1b9e77", "#d95f02")
) +
  theme_minimal(base_size = 14) +
  coord_cartesian(ylim = c(9, 11)) +   # ✅ 改这里
  theme(
    plot.title = element_text(hjust = 0.5, face = "bold"),
    legend.position = "bottom",
    legend.title = element_text(face = "bold"),
    panel.grid.minor = element_blank()
  )
```

## Figure 2: Q63 Contact

```{r}
# str(asia_1$COUNTRY)
library(interactions)
Confucian_Society$COUNTRY <- as.factor(Confucian_Society$COUNTRY)
model_2 <- lm(PP_Contact ~ q63_recode + gender + q63_recode*gender +
               age + education + married + rural +factor(COUNTRY), data = Confucian_Society)


# 
# interact_plot(model_2,
#               pred = q63_recode,
#               modx = gender,
#               data = asia_1,
#               plot.points = TRUE,
#               interval = TRUE)



interact_plot(
  model_2,
  pred = q63_recode,
  modx = gender,
  data = Confucian_Society,
  plot.points = FALSE,
  interval = TRUE,
  modx.labels = c("Men", "Women"),
  main.title = "Interaction Effect of Obedience to Mother-in-Law and Gender on PP_Contact",
  x.label = "Obedience to Mother-in-Law",
  y.label = "Predicted Possibility of Contact",
  legend.main = "Gender",
  colors = c("#1b9e77", "#d95f02")
) +
  theme_minimal(base_size = 14) +
  coord_cartesian(ylim = c(6, 8)) +
  theme(
    plot.title = element_text(hjust = 0.5, face = "bold"),
    legend.position = "bottom",
    legend.title = element_text(face = "bold"),
    panel.grid.minor = element_blank()
  )

```
